-- card: 3055 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2785 -- name: -- part 2 (field) -- low flags: 05 -- high flags: 0002 -- rect: left=0 top=0 right=28 bottom=256 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 9 -- style flags: 256 -- line height: 12 -- part name: CDRemotePrograms ----- HyperTalk script ----- on mouseUp put SystemFolder() & "CD Remote Programs" into me end mouseUp -- part 3 (field) -- low flags: 05 -- high flags: 0002 -- rect: left=0 top=30 right=256 bottom=256 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 256 -- line height: 12 -- part name: theText ----- HyperTalk script ----- on mouseUp put cd fld CDRemotePrograms into sourceFile put short name of this stack into thisStack put "My CD Collection" into newStack if there is not a file sourceFile then answer "File:" && quote & sourceFile & quote && "was not found!" with "Get A Life" exit mouseUp end if put resList (sourceFile) into temp repeat with i = 1 to number of lines in temp if line i of temp contains "STR#" then exit repeat end if end repeat if i >= number of lines in temp then answer "No discs found in:" && quote & sourceFile & quote && "!" with "Get A Life" exit mouseUp end if create stack newStack in new window if the result is not empty then answer "Could not create" && quote & newStack & quote & ". The file may already exist or the disk may be locked." with "Get A Life" exit mouseUp end if set script of stack newStack to script of me send firstCard to stack newStack doMenu "Close Stack" copyRes thisStack, newStack, "STR#", 8078 -- required for CD XCMDs. copyRes thisStack, newStack, "XFCN", cdDiscTitle copyRes thisStack, newStack, "XCMD", cdEject copyRes thisStack, newStack, "XCMD", cdOpen copyRes thisStack, newStack, "XCMD", cdPlayTrack copyRes thisStack, newStack, "XCMD", cdSetDiscTitle copyRes thisStack, newStack, "XFCN", cdStatus go to stack newStack in new window put "cleanup" && quote & thisStack & quote & comma && quote & sourceFile & quote into theMessage send theMessage to stack newStack end mouseUp on cleanup useStack, sourceFile start using stack useStack put resList (sourceFile) into temp repeat with i = 1 to number of lines in temp if line i of temp contains "STR#" then put item 3 of line i of temp into resourceID copyRes sourceFile, short name of this stack, "STR#", resourceID addDisc listDiscContents (resourceID) killRes "STR#", resourceID end if end repeat stop using stack useStack sort cards of this stack by bg fld discTitle set script of me to restOfScript (script of me, "***") doMenu "Compact Stack" show all cards end cleanup -- return delimited list of a CD's title and tracks function listDiscContents resourceID repeat with i = 1 to 999 put getStr (resourceID, i) into tempString if tempString is empty then exit repeat put tempString & return after theString end repeat return theString end listDiscContents on addDisc discInfo if bg fld 1 is not empty then doMenu "New Card" put line 1 of discInfo into bg fld discTitle put line 2 to 999 of discInfo into bg fld trackTitles end addDisc on firstCard trackScript createBgField1 createBgField2 createBgButton1 createBgButton2 set script of bg fld "discTitle" to partOfScript(script of me, "~~~") set script of bg fld "trackTitles" to partOfScript(script of me, "@@@") set script of bg btn "Go Prev" to partOfScript(script of me, "<<<") set script of bg btn "Go Next" to partOfScript(script of me, ">>>") end firstCard on createBgField theTop, theLeft, theBottom, theRight choose field tool doMenu "Background" drag from theLeft, theTop to theRight, theBottom with commandKey doMenu "Background" choose browse tool end createBgField on createBgField1 createBgField 0, 0, 15, 256 set name of bg fld 1 to "discTitle" set style of bg fld 1 to rectangle set lockText of bg fld 1 to true set textSize of bg fld 1 to 9 set textFont of bg fld 1 to Genvea set textStyle of bg fld 1 to bold set textAlign of bg fld 1 to center end createBgField1 on createBgField2 createBgField 17, 0, 235, 256 set name of bg fld 2 to "trackTitles" set style of bg fld 2 to scrolling set lockText of bg fld 2 to true set textSize of bg fld 2 to 9 set textFont of bg fld 2 to Genvea set textStyle of bg fld 2 to bold end createBgField2 on createBgButton theTop, theLeft, theBottom, theRight choose button tool doMenu "Background" drag from theLeft, theTop to theRight, theBottom with commandKey doMenu "Background" choose browse tool end createBgButton on createBgButton1 createBgButton 235, 0, 256, 30 set name of bg btn 1 to "Go Prev" set icon of bg btn 1 to "Prev Arrow" end createBgButton1 on createBgButton2 createBgButton 235, 226, 256, 256 set name of bg btn 2 to "Go Next" set icon of bg btn 2 to "Next Arrow" end createBgButton2 -- Return text of theScript located between two occurences of -- theToken & return. function partOfScript theScript, theToken put restOfScript (theScript, theToken) into theScript delete char offset (theToken & return, theScript) to 9999 of theScript delete last line of theScript return theScript end partOfScript -- Return text of theScript minus all text before theToken & return. function restOfScript theScript, theToken delete char 1 to offset (theToken & return, theScript) of theScript delete first line of theScript return theScript end restOfScript -- Permanent script of bg btn "Go Prev of the new stack is below. -- The partOfScript() routine will cut this script here ---> <<< on mouseUp visual effect wipe right do (short name of me) end mouseUp -- The partOfScript() routine will cut this script here ---> <<< -- Permanent script of bg btn "Go Next" of the new stack is below. -- The partOfScript() routine will cut this script here ---> >>> on mouseUp visual effect wipe left do (short name of me) end mouseUp -- The partOfScript() routine will cut this script here ---> >>> -- Permanent script of bg fld "discTitle" of the new stack is below. -- The partOfScript() routine will cut this script here ---> ~~~ on mouseUp edit script of this stack end mouseUp -- The partOfScript() routine will cut this script here ---> ~~~ -- Permanent script of bg fld "trackTitles" of the new stack is below. -- The partOfScript() routine will cut this script here ---> @@@ on mouseUp select the clickLine if the selection is empty then beep else playThis word 2 of the clickLine && bg fld discTitle wait 1 second select after last char of me end if end mouseUp -- The partOfScript() routine will cut this script here ---> @@@ -- Permanent script of the new stack is below. -- The restOfScript() routine will cut this script here ---> *** -- Stack created by Claussoft International's "CD Programs Reader" on playThis tuneInfo if tuneInfo is empty then exit playThis put word 1 of tuneInfo into trackNumber put word 2 to 99 of tuneInfo into discTitle if getCD (discTitle) then CDPlayTrack (trackNumber) end playThis function getCD discTitle global xxxCDRefNum CDOpen put CDDiscTitle() into currTitle if currTitle = discTitle then return true -- Correct CD found -- No CD found if xxxCDRefNum is empty or xxxCDRefNum = 0 then answer "Please insert the Compact Disc:" & return & " " & discTitle & "…" with "Cancel" or "OK" if it = "Cancel" then return false else mountCD return getCD(discTitle) end if end if -- Incorrect CD found if currTitle is empty then put "Untitled" into currTitle answer "The current Compact Disc is" && quote & currTitle & "." & quote & return & "It can be renamed to" && quote & discTitle & quote && "or ejected." with "Cancel" or "Rename CD" or "Eject CD" if it = "Cancel" then return false if it = "Rename CD" then renameCD currTitle, discTitle else CDEject end if return getCD(discTitle) end getCD on mountCD repeat until CDStatus() >= 0 CDOpen end repeat end mountCD on renameCD oldTitle, newTitle answer "Are you sure that you want to rename the CD:" && quote & oldTitle & quote && "to" && quote & newTitle & quote & "?" with "Cancel" or "Rename CD" if it = "Rename CD" then CDSetDiscTitle(newTitle) end renameCD